package FWK.core;

import org.apache.log4j.Logger;
import org.springframework.context.support.ClassPathXmlApplicationContext;



public class FwkContext extends ClassPathXmlApplicationContext{

	private static Logger logger = Logger.getLogger(FwkContext.class);
	
	private static FwkContext instance = null; 

	private FwkContext(String[] strings) {
		super(strings);
		//			URL url = new File("log4j.properties").toURI().toURL();
//		PropertyConfigurator.configure("log4j.properties");
	}

	private static void configurate() {
		logger.info("configurando el contexto de Spring");
		instance = new FwkContext(new String[] { "fwkConfig.xml" });
	}
	
	public static synchronized FwkContext getInstance(){
		if(instance == null){
			synchronized (FwkContext.class) {
				if(instance == null){
					configurate();
				}
			}
		}
		return instance;
	}
	
}
